package mp

import (
	"duoke/context"
	"duoke/utils/response"
	"duoke/utils/yaml"
	"github.com/gin-gonic/gin"
)

var Resource = new(resourceCtl)

type resourceCtl struct{}

func (ctl *resourceCtl) Index(c *gin.Context) {
	config := yaml.GetConfig()
	cdn := ""
	if config.Storage.Cdn == "" {
		cdn = context.Global.ResourceUrl
	} else {
		cdn = config.Storage.Cdn
	}
	imageList := gin.H{
		"defaultAvatar":    cdn + "/img/default-avatar.png",
		"meTopBg":          cdn + "/img/me-top-bg.jpg",
		"posterBg":         cdn + "/img/pintuan-poster-bg.png",
		"couponShareBg":    cdn + "/img/coupon-share-poster-bg.png",
		"couponGiveBg":     cdn + "/img/coupon-give-poster-bg.png",
		"coursePoster":     cdn + "/img/course-poster.png",
		"shortVideoPoster": cdn + "/img/short-poster.png",
	}
	response.Success(c, "", gin.H{"image": imageList})
}
